home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / alternativeLoft.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.3 KB  |  72 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Mar. 14, 1997
  22. //  Author:         ms
  23. //
  24. //  Description:
  25. //      Produce a lofted surface through the curves, but have it so that
  26. //      the resulting surface's CVs go through the original curves' CVs,
  27. //      rather than having the surface going through the curves.
  28.  
  29. global proc string alternativeLoft()
  30. {
  31.     int $hist = `constructionHistory -q -tgl`;
  32.  
  33.     global int $gSelectNurbsCurvesBit;
  34.     global int $gSelectIsoparmsBit;
  35.     global int $gSelectCurvesOnSurfacesBit;
  36.     global int $gSelectSurfaceEdgeBit;
  37.  
  38.     string $curves[] = `filterExpand -ex true -sm $gSelectNurbsCurvesBit -sm $gSelectIsoparmsBit -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit`;
  39.  
  40.     string $surface = "";
  41.  
  42.     int $n = size($curves);
  43.     int $i;
  44.  
  45.     if( $n < 2 ) return $surface;
  46.  
  47.     string $cmd = "loft -ch " + $hist + " ";
  48.  
  49.     // Rebuild them into linears (keep cvs):
  50.     for( $i=0; $i<$n; $i+=1 ) {
  51.         string $now[] = `rebuildCurve -ch $hist -rpo false -kcp on -d 1 -rt 0 $curves[$i]`;
  52.         $curves[$i] = $now[0];
  53.         $cmd = $cmd + $curves[$i] + " ";
  54.     }
  55.  
  56.     // Convert back into cubic:
  57.     string $res[] = eval($cmd);
  58.     if( size($res) > 0 ) {
  59.         $surface = $res[0];
  60.         rebuildSurface -ch $hist -rpo true -kcp on -du 3 -dv 3 -rt 0 $surface;
  61.     }
  62.  
  63.     if( !$hist ) {
  64.         for( $i=0; $i<$n; $i+=1 ) {
  65.             delete $curves[$i];
  66.         }
  67.     }
  68.  
  69.     select -r $surface;
  70.     return $surface;
  71. }
  72.